<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<h1>360推荐搜索</h1>
	<input type="text" name="user" value="" onkeyup="so()" />
	<ul></ul>
</body>
<script type="text/javascript">
	// function so(a){
	// 	alert(a.name);
	// }

	// so();
	function so(){
		var inp = document.getElementsByTagName('input')[0];
		var url = "http://sug.so.360.cn/suggest?callback=suggest_so&encodein=utf-8&encodeout=utf-8&format=json&fields=word,obdata&word=" + inp.value;
		var sc = document.createElement('script');
		sc.src = url;

		document.getElementsByTagName('head')[0].appendChild(sc);
	}

	function suggest_so(text){
		var html = '';

		for(var i=0; i<text.result.length; i++){
			html = html + '<li>' + text.result[i].word + '</li>';
		}

		document.getElementsByTagName('ul')[0].innerHTML = html;
	}

</script>
<script src="http://localhost/http/3.js"></script>
</html>